<?php
if(!defined('FEE_PATH')) exit();
$run = "  if(!defined('FEE_PATH')) exit();";

//加载系统扩展函数
require FEE_PATH . '/function/extend.fun.php';

//加载系统核心函数
require FEE_PATH . '/function/function.fun.php';
$run .= compile(FEE_PATH . '/function/function.fun.php');

//加载兼容函数
if (version_compare(PHP_VERSION, '5.2.0', '<')) {
	require FEE_PATH . '/function/compat.fun.php';
	$run .= compile(FEE_PATH . '/function/compat.fun.php');
}

// 加载系统惯例配置文件
C(require FEE_PATH . '/conf/config.inc.php');
$run .= 'C(' . var_export(C(), true) . ');';

//默认分组名称
if (!defined('DEFAULT_GROUP'))  define('DEFAULT_GROUP', C('DEFAULT_GROUP'));
$run .= "if (!defined('DEFAULT_GROUP'))  define('DEFAULT_GROUP', C('DEFAULT_GROUP'));";

//加载框架核心类库
$list[] = FEE_PATH . '/core/fee.class.php'; //加载核心基类
$list[] = FEE_PATH . '/core/fee_exception.class.php'; //异常处理类
$list[] = FEE_PATH . '/core/log.class.php'; //日志处理类
$list[] = FEE_PATH . '/core/app.class.php'; //应用程序类
$list[] = FEE_PATH . '/core/action.class.php'; //控制器类
$list[] = FEE_PATH . '/core/model.class.php'; //模型类
$list[] = FEE_PATH . '/core/view.class.php'; //视图类
$list[] = FEE_PATH . '/core/dispatcher.class.php'; //加载url调度器
foreach ($list as $file) {
	require $file;
	$run .= compile($file);
}

if((defined('RUN_TMP') && RUN_TMP == false) || !defined('RUN_TMP')){
	if (defined('RUN_TMP_SPACE') && RUN_TMP_SPACE == true) {
		file_put_contents($_run_file, "<?php" . $run);
	} else {
		file_put_contents($_run_file, strip_whitespace("<?php" . $run));
	}
}
